3.8 \(\int x \cot ^2(a+b x) \, dx\)

Optimal. Leaf size=31 \[ \frac{\log (\sin (a+b x))}{b^2}-\frac{x \cot (a+b x)}{b}-\frac{x^2}{2} \]

[Out]

-x^2/2 - (x*Cot[a + b*x])/b + Log[Sin[a + b*x]]/b^2

________________________________________________________________________________________

Rubi [A]  time = 0.0228298, antiderivative size = 31, normalized size of antiderivative = 1., number of steps used = 3, number of rules used = 3, integrand size = 10, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.3, Rules used = {3720, 3475, 30} \[ \frac{\log (\sin (a+b x))}{b^2}-\frac{x \cot (a+b x)}{b}-\frac{x^2}{2} \]

Antiderivative was successfully verified.

[In]

Int[x*Cot[a + b*x]^2,x]

[Out]

-x^2/2 - (x*Cot[a + b*x])/b + Log[Sin[a + b*x]]/b^2

Rule 3720

Int[((c_.) + (d_.)*(x_))^(m_.)*((b_.)*tan[(e_.) + (f_.)*(x_)])^(n_), x_Symbol] :> Simp[(b*(c + d*x)^m*(b*Tan[e
 + f*x])^(n - 1))/(f*(n - 1)), x] + (-Dist[(b*d*m)/(f*(n - 1)), Int[(c + d*x)^(m - 1)*(b*Tan[e + f*x])^(n - 1)
, x], x] - Dist[b^2, Int[(c + d*x)^m*(b*Tan[e + f*x])^(n - 2), x], x]) /; FreeQ[{b, c, d, e, f}, x] && GtQ[n,
1] && GtQ[m, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rule 30

Int[(x_)^(m_.), x_Symbol] :> Simp[x^(m + 1)/(m + 1), x] /; FreeQ[m, x] && NeQ[m, -1]

Rubi steps

\begin{align*} \int x \cot ^2(a+b x) \, dx &=-\frac{x \cot (a+b x)}{b}+\frac{\int \cot (a+b x) \, dx}{b}-\int x \, dx\\ &=-\frac{x^2}{2}-\frac{x \cot (a+b x)}{b}+\frac{\log (\sin (a+b x))}{b^2}\\ \end{align*}

Mathematica [A]  time = 0.199293, size = 44, normalized size = 1.42 \[ \frac{\log (\sin (a+b x))}{b^2}-\frac{x \cot (a)}{b}+\frac{x \csc (a) \sin (b x) \csc (a+b x)}{b}-\frac{x^2}{2} \]

Antiderivative was successfully verified.

[In]

Integrate[x*Cot[a + b*x]^2,x]

[Out]

-x^2/2 - (x*Cot[a])/b + Log[Sin[a + b*x]]/b^2 + (x*Csc[a]*Csc[a + b*x]*Sin[b*x])/b

________________________________________________________________________________________

Maple [A]  time = 0.043, size = 30, normalized size = 1. \begin{align*} -{\frac{{x}^{2}}{2}}-{\frac{x\cot \left ( bx+a \right ) }{b}}+{\frac{\ln \left ( \sin \left ( bx+a \right ) \right ) }{{b}^{2}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x*cot(b*x+a)^2,x)

[Out]

-1/2*x^2-x*cot(b*x+a)/b+ln(sin(b*x+a))/b^2

________________________________________________________________________________________

Maxima [B]  time = 1.68781, size = 363, normalized size = 11.71 \begin{align*} \frac{2 \,{\left (b x + a + \frac{1}{\tan \left (b x + a\right )}\right )} a - \frac{{\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right )^{2} +{\left (b x + a\right )}^{2} \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \,{\left (b x + a\right )}^{2} \cos \left (2 \, b x + 2 \, a\right ) +{\left (b x + a\right )}^{2} -{\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} + 2 \, \cos \left (b x + a\right ) + 1\right ) -{\left (\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1\right )} \log \left (\cos \left (b x + a\right )^{2} + \sin \left (b x + a\right )^{2} - 2 \, \cos \left (b x + a\right ) + 1\right ) + 4 \,{\left (b x + a\right )} \sin \left (2 \, b x + 2 \, a\right )}{\cos \left (2 \, b x + 2 \, a\right )^{2} + \sin \left (2 \, b x + 2 \, a\right )^{2} - 2 \, \cos \left (2 \, b x + 2 \, a\right ) + 1}}{2 \, b^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="maxima")

[Out]

1/2*(2*(b*x + a + 1/tan(b*x + a))*a - ((b*x + a)^2*cos(2*b*x + 2*a)^2 + (b*x + a)^2*sin(2*b*x + 2*a)^2 - 2*(b*
x + a)^2*cos(2*b*x + 2*a) + (b*x + a)^2 - (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1)*l
og(cos(b*x + a)^2 + sin(b*x + a)^2 + 2*cos(b*x + a) + 1) - (cos(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*
b*x + 2*a) + 1)*log(cos(b*x + a)^2 + sin(b*x + a)^2 - 2*cos(b*x + a) + 1) + 4*(b*x + a)*sin(2*b*x + 2*a))/(cos
(2*b*x + 2*a)^2 + sin(2*b*x + 2*a)^2 - 2*cos(2*b*x + 2*a) + 1))/b^2

________________________________________________________________________________________

Fricas [B]  time = 1.71928, size = 190, normalized size = 6.13 \begin{align*} -\frac{b^{2} x^{2} \sin \left (2 \, b x + 2 \, a\right ) + 2 \, b x \cos \left (2 \, b x + 2 \, a\right ) + 2 \, b x - \log \left (-\frac{1}{2} \, \cos \left (2 \, b x + 2 \, a\right ) + \frac{1}{2}\right ) \sin \left (2 \, b x + 2 \, a\right )}{2 \, b^{2} \sin \left (2 \, b x + 2 \, a\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="fricas")

[Out]

-1/2*(b^2*x^2*sin(2*b*x + 2*a) + 2*b*x*cos(2*b*x + 2*a) + 2*b*x - log(-1/2*cos(2*b*x + 2*a) + 1/2)*sin(2*b*x +
 2*a))/(b^2*sin(2*b*x + 2*a))

________________________________________________________________________________________

Sympy [A]  time = 0.525852, size = 65, normalized size = 2.1 \begin{align*} \begin{cases} \tilde{\infty } x^{2} & \text{for}\: a = 0 \wedge b = 0 \\\frac{x^{2} \cot ^{2}{\left (a \right )}}{2} & \text{for}\: b = 0 \\\tilde{\infty } x^{2} & \text{for}\: a = - b x \\- \frac{x^{2}}{2} - \frac{x}{b \tan{\left (a + b x \right )}} - \frac{\log{\left (\tan ^{2}{\left (a + b x \right )} + 1 \right )}}{2 b^{2}} + \frac{\log{\left (\tan{\left (a + b x \right )} \right )}}{b^{2}} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)**2,x)

[Out]

Piecewise((zoo*x**2, Eq(a, 0) & Eq(b, 0)), (x**2*cot(a)**2/2, Eq(b, 0)), (zoo*x**2, Eq(a, -b*x)), (-x**2/2 - x
/(b*tan(a + b*x)) - log(tan(a + b*x)**2 + 1)/(2*b**2) + log(tan(a + b*x))/b**2, True))

________________________________________________________________________________________

Giac [B]  time = 2.15704, size = 1688, normalized size = 54.45 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x*cot(b*x+a)^2,x, algorithm="giac")

[Out]

-1/2*(b^2*x^2*tan(1/2*b*x)^2*tan(1/2*a) + b^2*x^2*tan(1/2*b*x)*tan(1/2*a)^2 - b*x*tan(1/2*b*x)^2*tan(1/2*a)^2
- b^2*x^2*tan(1/2*b*x) - b^2*x^2*tan(1/2*a) + b*x*tan(1/2*b*x)^2 + 4*b*x*tan(1/2*b*x)*tan(1/2*a) - log(16*(tan
(1/2*a)^4 + 2*tan(1/2*a)^2 + 1)/(tan(1/2*b*x)^8*tan(1/2*a)^2 + 2*tan(1/2*b*x)^7*tan(1/2*a)^3 + tan(1/2*b*x)^6*
tan(1/2*a)^4 - 2*tan(1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